From 56be995b8a60ebe8a30e349674cc8abae5e1a559 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Tue, 15 Nov 2005 17:30:55 +0100 Subject: [PATCH] This patch fixes dom0 SMP vcpu hotplug. Currently, domains without config files (e.g. dom0) don't set info['vcpus'] correctly resulting in incorrect cpu availablity values in the store. This prevents hotplug from functioning. Signed-off-by: Ryan Harper --- tools/python/xen/xend/XendDomainInfo.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index c634cb8623..3b50fc9be6 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -437,12 +437,18 @@ class XendDomainInfo: defaultInfo('on_crash', lambda: "restart") defaultInfo('cpu', lambda: None) defaultInfo('cpu_weight', lambda: 1.0) - defaultInfo('vcpus', lambda: int(1)) - defaultInfo('online_vcpus', lambda: self.info['vcpus']) - self.info['vcpus'] = int(self.info['vcpus']) - defaultInfo('max_vcpu_id', lambda: self.info['vcpus']-1) + # some domains don't have a config file (e.g. dom0 ) + # to set number of vcpus so we derive available cpus + # from max_vcpu_id which is present for running domains. + if not self.infoIsSet('vcpus') and self.infoIsSet('max_vcpu_id'): + avail = int(self.info['max_vcpu_id'])+1 + else: + avail = int(1) + defaultInfo('vcpus', lambda: avail) + defaultInfo('online_vcpus', lambda: self.info['vcpus']) + defaultInfo('max_vcpu_id', lambda: self.info['vcpus']-1) defaultInfo('vcpu_avail', lambda: (1 << self.info['vcpus']) - 1) defaultInfo('memory', lambda: 0) -- 2.30.2